<template>
  <u-popup mode="bottom" :value="show" @close="onClose">
    <view class="upload-dialog">
      <view class="upload-grid">
        <view class="upload-item" @click="onSelect(0)">
          <view class="upload-icon">
            <u-icon name="chat" size="60" color="#666"></u-icon>
          </view>
          <text class="upload-text">微信文件</text>
        </view>
        
        <view class="upload-item" @click="onSelect(1)">
          <view class="upload-icon">
            <u-icon name="photo" size="60" color="#666"></u-icon>
          </view>
          <text class="upload-text">本地相册</text>
        </view>
      </view>
      
      <view class="divider"></view>
      
      <view class="cancel-btn" @click="onClose">
        取消
      </view>
    </view>
  </u-popup>
</template>

<script>
export default {
  name: 'FileUploadDialog',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    options: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    onSelect(index) {
      this.$emit('select', index)
      this.$emit('update:show', false)
    },
    onClose() {
      this.$emit('update:show', false)
    }
  }
}
</script>

<style lang="scss" scoped>
.upload-dialog {
  background-color: #f7f7f7;
  
  .upload-grid {
    display: flex;
    justify-content: center;
    padding: 50rpx 0;
    background-color: #ffffff;
    border-radius: 20rpx 20rpx 0 0;
    
    .upload-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin: 0 50rpx;
      
      .upload-icon {
        width: 120rpx;
        height: 120rpx;
        background-color: #f7f7f7;
        border-radius: 20rpx;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 16rpx;
      }
      
      .upload-text {
        font-size: 28rpx;
        color: #333;
      }
    }
  }
  
  .divider {
    height: 16rpx;
    background-color: #f7f7f7;
  }
  
  .cancel-btn {
    height: 100rpx;
    line-height: 100rpx;
    text-align: center;
    font-size: 32rpx;
    color: #333;
    background-color: #ffffff;
  }
}
</style> 